package sgd.tp2.client.cmdline;

import sgd.tp2.api.cmdline.CDRFormatConverter;
import sgd.tp2.api.cmdline.NetProtocolPortConverter;
import sgd.tp2.api.cmdline.NetProtocolTypeConverter;
import sgd.tp2.api.cmdline.PacketSizeConverter;
import sgd.tp2.api.cmdline.SendingIntervalConverter;
import sgd.tp2.api.net.CDRFormatType;
import sgd.tp2.api.net.NetProtocolType;

import com.beust.jcommander.Parameter;
import com.beust.jcommander.Parameters;

@Parameters(separators = "=")
public class ConfigurationOptions {

	@Parameter(names = { "-protocol", "-t" }, converter = NetProtocolTypeConverter.class, description = "Protocolo de transporte usado. Estao disponiveis apenas TCP e UDP")
	public NetProtocolType protocol = NetProtocolType.TCP;

	@Parameter(names = { "-serverAddress", "-a" }, description = "Endereco de ligacao ao servidor")
	public String serverAddress = "localhost";

	@Parameter(names = { "-serverPort", "-p" }, converter = NetProtocolPortConverter.class, description = "Porta de ligacao ao servidor")
	public int serverPort = 1234;

	@Parameter(names = { "-format", "-f" }, converter = CDRFormatConverter.class, description = "Formato de dados enviados. Estao disponiveis os formatos XML, JSON, CSV, Object ou Bytes")
	public CDRFormatType format = CDRFormatType.XML;

	@Parameter(names = { "-packetSize", "-s" }, converter = PacketSizeConverter.class, description = "Tamanho do buffer de escrita, no caso de uso do protocolo UDP")
	public int packetSize = 1024;

	@Parameter(names = { "-interval", "-i" }, converter = SendingIntervalConverter.class, description = "Intervalo entre envios de mensagens para o servidor")
	public int interval = 500;
}
